﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace AS3___CG
{
    public class Camera
    {
        public Vector3 cTar;
        public Vector3 cPos;
        public Matrix projection;
        public Matrix view;
        public Vector3 cUp;
        private GraphicsDevice _graphicsDevice;
        public float _aspectRatio;

        public Camera(GraphicsDevice graphicsDevice)
        {
            _graphicsDevice = graphicsDevice;
        }
        
        public void InitCamera(float degrees, float aspectRatio)
        {
            _aspectRatio = _graphicsDevice.DisplayMode.AspectRatio;
            cTar = Vector3.Zero;
            cUp = Vector3.Up;
            cPos = new Vector3(0, 0, 50f);

            Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(degrees), aspectRatio, 1.0f, 10000.0f, out projection);
        }

     

        public Matrix GetLookAt()
        {
            Matrix.CreateLookAt(ref cPos, ref cTar, ref cUp, out view);
            return view;
        }
    
    }
}
